/**
 * GBox.h
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/07/05
 */



#pragma once

#include "Vec.h"

class CGBox
{
public:
    CGBox() {}
    CGBox(double x1, double y1, double z1,
        double x2, double y2, double z2)
    {
        m_min = CVec(x1, y1, z1);
        m_max = CVec(x2, y2, z2);
    }
    virtual ~CGBox() {}

// operator
    void  operator=(CGBox& box);
    double  operator[](int i);

// attribute
	CVec			GetMin() { return m_min; }
	CVec			GetMax() { return m_max; }

private:
	CVec			m_min;
	CVec			m_max;
};


inline void CGBox::operator=(CGBox& box)
{
	m_min = box.m_min;
	m_max = box.m_max;
}

inline double CGBox::operator[](int i)
{
	if (i < 3)
	{
		return m_min[i];
	}
	else
	{
		return m_max[i%3];
	}
}